import Axios from '@/config/api.config.js'

// const FILE_HOST_URL = 'http://ogay6cpdg.bkt.clouddn.com/' // qiqiu domain
const FILE_HOST_URL = 'https://file.njcomei.com/' // qiqiu domain
const BASE_URL = 'https://comei.10maker.com'
const EXPORT_EXCEL = '/uhaou/order/exportExcel.htm'

export default {
  FILE_HOST_URL,
  BASE_URL,
  EXPORT_EXCEL,

  /* 登录 */
  async login (params) { // 登录
    return Axios.post('/system/login', params)
  },
  async loginOut () { // 登出
    return Axios.post('/system/logout')
  },
  async updateAccessToken () { // 更新token
    return Axios.post('/system/updateAccessToken')
  },
  async getUserInfo (params) { // 用户信息
    return Axios.post('/passports/detail', params)
  },
  async modifyPwd (params) {
    return Axios.post('/passports/changePassword', params)
  },
  async getCaptch (params) {
    return Axios.post('/system/getCaptchaImage', params)
  },

  /* 菜单 */
  async getMenuList () {
    return Axios.post('/system/app/list')
  },

  /* 上传文件 */
  async getQiNiuToken (params) { // 获取七牛上传token
    return Axios.post('/qiniu/getUploadToken', params)
  },
  async getDownloadUrl (params) { // 获取带私有下载参数的七牛下载URL
    return Axios.post('qiniu/getDownloadUrl', {s: params})
  },

  /* 商品管理 */
  async getLabelList (params) { // 商品标签列表
    return Axios.post('/uhaou/item/labels', params)
  },
  async getProductList (params) { // 商品列表
    return Axios.post('/uhaou/item/query', params)
  },
  async addProduct (params) { // 添加商品
    return Axios.post('/uhaou/item/add', params)
  },
  async getTypeList (params) { // 商品类别列表
    return Axios.post('/uhaou/item/seriess/query', params)
  },
  async showProductDetail (params) { // 查看商品详情
    return Axios.post('/uhaou/item/detail', params)
  },
  async takeOffProduct (params) { // 下架商品
    return Axios.post('/uhaou/item/takeOff', params)
  },
  async takeUpProduct (params) { // 上架商品
    return Axios.post('/uhaou/item/takeOn', params)
  },
  async editProduct (params) { // 商品编辑
    return Axios.post('/uhaou/item/update', params)
  },
  async deleteProduct (params) { // 删除商品
    return Axios.post('/uhaou/item/delete', params)
  },

  /* 分类管理 */
  async addSeriess (params) { // 保存商品分类
    return Axios.post('/uhaou/item/seriess/save', params)
  },
  async deleteSeriess (params) { // 删除商品分类
    return Axios.post('/uhaou/item/seriess/delete', params)
  },

  /* 订单管理 */
  async getOrderList (params) { // 订单列表（除退款订单）
    return Axios.post('/uhaou/order/query', params)
  },
  async getRefundOrderList (params) { // 退款订单列表
    return Axios.post('/uhaou/order/refund/query', params)
  },
  async deliverGoods (params) { // 发货
    return Axios.post('/uhaou/order/send.htm', params)
  },
  async pickGoods (params) { // 就医或上门取货
    return Axios.post('/uhaou/order/pick', params)
  },
  async refundOk (params) { // 确认退款
    return Axios.post('/uhaou/order/refund/permit', params)
  },
  async refundNo (params) { // 拒绝退款
    return Axios.post('/uhaou/order/refund/reject', params)
  },
  async timesToConfirmSpec (params) { // 分批确认的规格
    return Axios.post('/uhaou/order/spec/query', params)
  },
  async timesToConfirm (params) { // 分批确认
    return Axios.post('/uhaou/order/partialConfirm', params)
  },
  async getOrderDetail (params) { // 订单详情
    return Axios.post('/uhaou/order/detail', params)
  },
  async auditOrder (params) { // 已付款订单的审核
    return Axios.post('/uhaou/order/meet', params)
  },

  /* 奖券管理 */
  async queryTicket (params) { // 查询券数据
    return Axios.post('/uhaou/system/ticket/query', params)
  },
  async saveTicket (params) { // 保存券
    return Axios.post('/uhaou/system/ticket/save', params)
  },
  async deleteTicket (params) { // 删除优惠券
    return Axios.post('/uhaou/system/ticket/delete', params)
  },

  /* 用户管理 */
  async queryAccount (params) { // 客户数据
    return Axios.post('/uhaou/account/query', params)
  },
  async queryAccountDetail (params) { // 用户详情
    return Axios.post('/uhaou/account/detail', params)
  },
  async personAssetsProfile (params) { // 个人资产-概要信息
    return Axios.post('/uhaou/account/summarize', params)
  },
  async getIntegralRecord (params) { // 个人资产——积分记录
    return Axios.post('/uhaou/account/creditRecord/query', params)
  },
  async getDistributor (params) { // 个人资产——分销商
    return Axios.post('/uhaou/account/distributor/query', params)
  },
  async getWithdrawalRecord (params) { // 个人资产——提现记录
    return Axios.post('/uhaou/account/withdraw/query', params)
  },
  async getEarningsRecord (params) { // 收益记录
    return Axios.post('/uhaou/account/reward/query', params)
  },
  async createCredit (params) { // 手动创新增积分
    return Axios.post('/uhaou/account/createCredit', params)
  },

  /* 分销管理 */
  async getWithdrawList (params) { // 分销列表
    return Axios.post('/uhaou/account/withdraw/list', params)
  },
  async permitRefund (params) { // 同意提现
    return Axios.post('/uhaou/account/withdraw/permit', params)
  },
  async rejectRefund (params) { // 拒绝提现
    return Axios.post('/uhaou/account/withdraw/reject', params)
  },
  async getWithdrawErrDetail (params) { // 错误的详情信息
    return Axios.post('/uhaou/account/certificate/query', params)
  },

  /* banner管理 */
  async getBannerList (params) { // banne列表
    return Axios.post('/uhaou/system/index/list', params)
  },
  async deleteOneBanner (params) { // 删除banner
    return Axios.post('/uhaou/system/index/delete', params)
  },
  async addOneBanner (params) { // 添加banner
    return Axios.post('/uhaou/system/index/add', params)
  },
  async getBannerDetail (params) { // banner详情
    return Axios.post('/uhaou/system/index/detail', params)
  },
  async editBanner (params) { // 编辑banner
    return Axios.post('/uhaou/system/index/update', params)
  },

  /* 活动管理 */
  async queryActivityList (params) {
    return Axios.post('/uhaou/system/page/query', params)
  },
  async addActivity (params) { // 添加活动
    return Axios.post('/uhaou/system/page/save', params)
  },
  async deleteActivity (params) { // 删除活动
    return Axios.post('/uhaou/system/page/delete', params)
  },

  /* 统计报表 */
  async querySpendOrderReport (params) { // 已付款订单报表
    return Axios.post('/uhaou/order/spend/query', params)
  },
  async exportExcel (params) { // 导出报表
    return Axios.post('/uhaou/order/exportExcel', params)
  }
}
